package eric.Pulpfire.src;

import pulpcore.scene.Scene2D;
import pulpcore.image.CoreImage;
import pulpcore.image.CoreFont;
import pulpcore.sprite.*;
import pulpcore.Input;
import pulpcore.Stage;
import pulpcore.animation.Easing;
import static pulpcore.image.Colors.*;

/**
 * Created by IntelliJ IDEA.
 * User: eric
 * Date: Jun 2, 2008
 * Time: 8:27:53 PM
 * To change this template use File | Settings | File Templates.
 */
public class ScoreScene extends Scene2D {
    private float playerSucks, enemySucks;
    private CoreImage screenShot;
    private float suckRatio;

    public ScoreScene(float playerSuck, float enemySuck, CoreImage shot) {
        screenShot = shot;
        playerSucks = playerSuck;
        enemySucks = enemySuck;
        suckRatio = playerSucks/(enemySucks+.01f);
                        
    }

    Label answer;
    TextField textField;
    TextField passwordField;
    Button okButton;
    Button checkbox;
    Slider slider;
    Group form;

    @Override
    public void load() {
        CoreFont font = CoreFont.getSystemFont().tint(WHITE);


        // Create the form fields

        String suckString2 = "You suck "+suckRatio+" times as much as the computer.";
        
        Label label4 = new Label(font, suckString2, 0, 70);
        label4.setAnchor(Sprite.CENTER);

        CoreImage buttonImage = CoreImage.load("button.png");
        okButton = new Button(buttonImage.split(3), 0, 160);
        okButton.setAnchor(Sprite.NORTH);
        okButton.setKeyBinding(Input.KEY_ENTER);

        // Add the form fields to a group
        form = new Group(Stage.getWidth() / 2, Stage.getHeight() / 2);

        form.setLocation(Stage.getWidth() / 2, Stage.getHeight() / 2);
        form.add(label4);
        form.add(okButton);
        form.setAnchor(Sprite.CENTER);
        form.pack();

        // Add background and form to the scene
        add(new FilledSprite(BLACK));
        screenShot = screenShot.fade(150);
        add(new ImageSprite(screenShot,0,0));
                                     
        addLayer(form);
    }

    @Override
    public void update(int elapsedTime) {
        if (okButton.isClicked()) {
            Stage.popScene();
        }
    }
}
